package com.tencent.face.config;

import com.tencent.face.service.TencentApiService;
import com.tencent.face.service.impl.TencentApiServiceImpl;
import com.tencent.face.util.TencentHttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@EnableConfigurationProperties(FaceConfigParam.class)
@Configuration
public class TencentHttpAutoConfiguration {

    @Autowired
    private FaceConfigParam faceConfigParam;

    @Bean
    @ConditionalOnMissingBean
    public TencentHttpUtil tencentHttpUtil(){
        return new TencentHttpUtil(faceConfigParam);
    }

    @Bean
    @ConditionalOnMissingBean
    public TencentApiService tencentApiService(){
        return new TencentApiServiceImpl();
    }
}
